<!--富文本编辑器 绑定值 editorValue-->
<template>
  <el-date-picker
    v-model="time"
    end-placeholder="结束时间"
    format="YYYY-MM-DD HH:mm:ss"
    range-separator="-"
    start-placeholder="开始时间"
    type="datetimerange"
    value-format="YYYY-MM-DD HH:mm:ss"
    @change="timeChange"
  />
</template>
<script lang="ts" setup>
let props = defineProps({
  dateTime: {
    startTime: String,
    endTime: String
  }
})
const time = ref([])
const emit = defineEmits(['update:dateTime'])
onMounted(() => {
  time.value[0] = props.dateTime.startTime
  time.value[1] = props.dateTime.endTime
})
const timeChange = (val: any) => {
  const dateData = props
  dateData.dateTime.startTime = val[0]
  dateData.dateTime.endTime = val[1]
  emit('update:dateTime', dateData.dateTime)
}
</script>
